//
//  CityRecorderInfoSecCell.m
//  AppFrame
//
//  Created by GXJ on 2017/3/6.
//  Copyright © 2017年 GXJ. All rights reserved.
//

#import "CityRecorderInfoSecCell.h"

@implementation CityRecorderInfoSecCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *cellsign = @"CityRecorderInfoSecCell";
    CityRecorderInfoSecCell *cell  = [tableView dequeueReusableCellWithIdentifier:cellsign];
    if (cell ==nil) {
        cell  = [[CityRecorderInfoSecCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellsign];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        _titleLab = [[UILabel alloc]init];
        _titleLab.numberOfLines = 0;
        _titleLab.font = [UIFont systemFontOfSize:18];
        _titleLab.textColor = [UIColor colorWithHexString:@"#666666"];
        _titleLab.text = @"郑州地铁4号线最新进展，站点从28座变成26座！";
        [self addSubview:_titleLab];
        
        _timeLab = [[UILabel alloc]init];
        _timeLab.font = [UIFont systemFontOfSize:12];
        _timeLab.textColor = [UIColor colorWithHexString:@"#888888"];
        _timeLab.text = @"2016-09-10";
        [self addSubview:_timeLab];
        
        _line = [[UIView alloc]init];
        _line.backgroundColor = [UIColor colorWithHexString:@"#888888"];
        [self addSubview:_line];
        
        _nameLab = [[UILabel alloc]init];
        _nameLab.font = [UIFont systemFontOfSize:12];
        _nameLab.textColor = [UIColor colorWithHexString:@"#888888"];
        _nameLab.text = @"东方日报";
        [self addSubview:_nameLab];
        
        _picture = [[UIImageView alloc]init];
        _picture.backgroundColor = [UIColor lightGrayColor];
        [self addSubview:_picture];
        
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    CGSize titleSize = [StringSizeModel sizeWithText:_titleLab.text font:[UIFont systemFontOfSize:18] maxW:SCREENWIDTH-30];
    
    _titleLab.frame = CGRectMake(15,20, self.frame.size.width-30, titleSize.height);
    _picture.frame = CGRectMake(15,CGRectGetMaxY(_titleLab.frame)+10,SCREENWIDTH-30,(SCREENWIDTH-30)/2);
    
    CGSize timeSize = [StringSizeModel sizeWithText:_timeLab.text font:[UIFont systemFontOfSize:12]];
    
    _timeLab.frame = CGRectMake(15,CGRectGetMaxY(_picture.frame)+10,timeSize.width,12);
    _line.frame = CGRectMake(15+timeSize.width+5,CGRectGetMaxY(_picture.frame)+10,1,12);
    _nameLab.frame = CGRectMake(15+timeSize.width+11,CGRectGetMaxY(_picture.frame)+10,80,12);
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
